Computer instruction sets are used to encode the set of operations that a central processing unit (CPU) executes within a program. It is desirable to minimize the amount of memory used to store these instructions. For example, one instruction set may use 32 bits to encode instructions. The use of 32 bits provides for the encoding of a rich instruction set but does not allow more common operations to be encoded using fewer bits. Another instruction set may use 16 bits to encode instructions. The use of 16 bits provides for high code density but limits the number of instructions that can be encoded.
One solution to the limited number of instructions that can be encoded using smaller instructions (e.g. 16 bits) is to allow a previous instruction to modify the meaning of the current instruction. The previous modifying instruction is known as a prefix instruction. In this way, common operations use a single instruction (e.g. 16 bits) whereas less common instructions use two instructions (one prefix instruction and one base instruction with, for example, 32 bits total). This provides a good compromise between code density and richness of instruction.
The embodiments described below are provided by way of example only and are not limiting of implementations which solve any or all of the disadvantages of known computers.